<?php
include("../includes/config.inc.php");
include("../includes/jphpframework.php");

$db = new JDb($dsn);
$tpl = new JTemplate("../templates/");

if(Utils::isVal($_GET['page'])){
    $fn = str_replace("_", "/", $_GET['page']);
    if(file_exists("../pages/".$fn.".php")){
        include("../pages/".$fn.".php");
    }
}else{
    $query = "Show Tables";
    $res =& $db->select($query);
    while($row =& $res->fetchRow()){
        $content .= "<a href='./?page={$row['Tables_in_'.$dsn['database']]}_list'>{$row['Tables_in_'.$dsn['database']]}</a><br>";
    }
    $tpl->assign('content', $content);
}

$tpl->display('default.html');